//
//  MyMoneyTableViewCell.m
//  HTP
//
//  Created by 王鑫 on 15/11/1.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "MyMoneyTableViewCell.h"

#define headfootbutton ScreenWidth / 3.0

@interface MyMoneyTableViewCell ()

@property (nonatomic,retain) UIImageView *icoImage;

@property (nonatomic,retain) UILabel *label;

@property (nonatomic,retain) NSDictionary *cellDic;

@property (nonatomic,retain) UIImageView *line1;

@property (nonatomic,retain) UIImageView *line2;

@end

@implementation MyMoneyTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self _initUI];
    }
    return self;
}

//TODO:控件添加
- (void)_initUI {
    
    _icoImage = [[UIImageView alloc] init];
    [self.contentView addSubview:self.icoImage];
    
    _label = [[UILabel alloc] init];
    _label.font = [UIFont systemFontOfSize:17.0f];
    [self.contentView addSubview:self.label];

    _line1 = [[UIImageView alloc] init];
    [_line1 setAlpha:0.7];
    [self.contentView addSubview:_line1];
    
    _line2 = [[UIImageView alloc] init];
    [_line2 setAlpha:0.7];
    [self.contentView addSubview:_line2];
}

//TODO:控件位置设置
- (void)layoutSubviews{
    [_icoImage setFrame:CGRectMake((headfootbutton - 60) / 2.0, 10, 20, 20)];
    
    [_label setFrame:CGRectMake(70, 10, 100, 20)];
    [_line1 setFrame:CGRectMake(0, 40, ScreenWidth, 1)];
    [_line2 setFrame:CGRectMake(0, 0, ScreenWidth, 1)];
}

//TODO:控件数据设置
- (void)setCellData:(id)cellData {
    _cellDic = (NSDictionary *)cellData;
    _icoImage.image = [UIImage imageNamed:_cellDic[@"icoName"]];
    
    _label.text = _cellDic[@"infoText"];
    
    _line1.image = [UIImage imageNamed:@"line_zhangdan"];
    _line2.image = [UIImage imageNamed:@"line_zhangdan"];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
